package org.dromara.oce.constant;

import lombok.Getter;
import org.dromara.common.core.domain.dto.TypeDto;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 推广应用类型枚举
 *
 * @author ruoyi
 */
public enum ReferralAppType {
    REFERRAL_APP_TYPE_DOUYIN(1,"抖音小程序"),
    REFERRAL_APP_TYPE_KUAISHOU(2,"快手小程序"),
    REFERRAL_APP_TYPE_WECHAT(3,"微信小程序");
    @Getter
    private final int type;
    private final String desc;

    private ReferralAppType(int type, String desc) {
        this.type = type;
        this.desc = desc;
    }
    public static String getDescByType(int type) {
        for (ReferralAppType e : ReferralAppType.values()) {
            if (e.getType() == type) {
                return e.desc;
            }
        }
        return null;
    }

    public static List<TypeDto> getAllType() {
        List<TypeDto> types = new ArrayList<>();
        ReferralAppType[] values = ReferralAppType.class.getEnumConstants();
        for (ReferralAppType value : values) {
            TypeDto map = new TypeDto();
            map.setType(value.type + "");
            map.setDesc(value.desc);
            types.add(map);
        }
        return types;
    }
}
